﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace CodeTunnel.MvcUtilities.Validators
{
    /// <summary>
    /// Attribute used to validate an email address.
    /// </summary>
    public class EmailAttribute : RegularExpressionAttribute
    {
        /// <summary>
        /// Call base constructor and pass in email regular expression.
        /// </summary>
        public EmailAttribute()
            : base(@"^[a-zA-Z0-9_\+-]+(\.[a-zA-Z0-9_\+-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.([a-zA-Z]{2,4})$") { }
    }
}
